Skip to content

Lock down the contract of SelfOrganizingLinkedList - #71

Open
hotasourav8-sketch wants to merge 1 commit into
S-AI-Projects:masterfrom
hotasourav8-sketch:student/e26b07f0855/R45-T021
Open

hotasourav8-sketch wants to merge 1 commit into
S-AI-Projects:masterfrom
hotasourav8-sketch:student/e26b07f0855/R45-T021

Conversation

@hotasourav8-sketch

Copy link
Copy Markdown

Description
This PR locks down the behavioral contract of SelfOrganizingLinkedList (Move-To-Front strategy). Comprehensive contract tests are added to verify initialization invariants, insertion tail-ordering, move-to-front pointer manipulation, head-search stability, absent-key search purity, and null-element compatibility.

Related Issue
Fixes: #21

Type of Change
● Tests

Changes Made

  • Created SelfOrganizingLinkedListContractTest.java covering contract specifications C1 through C9.
  • Verified MTF pointer rewiring for head, middle, tail, absent, and duplicate elements.
  • Tested size invariance across repeated searches and generic type independence.

Screenshots / Recordings
N/A (Backend / Unit test changes only)

Testing
Executed JUnit 5 test suite:
mvn test -Dtest=SelfOrganizingLinkedListContractTest

Checklist
● I have tested my changes locally.
● I have added or updated tests, if needed.
● I have updated documentation, if needed.
● I have followed the project's coding guidelines.
● I have run the relevant tests and checks.
● I have addressed previous review feedback, if applicable.

Additional Notes
All new tests are hermetic and run independently without external dependencies.

Lock down the behavioral contracts of the Move-To-Front self-organizing
linked list including: empty list invariants, insert-appends-to-tail,
search-moves-to-front, search-on-head is a no-op, absent-search returns
false without side effects, null-element handling, and generic-type support.

Fixes: S-AI-Projects#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant